package com.bitoon.basketdudes.jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * @author PacoFELC 2011
 */
@Embeddable
public class VisitaPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "usuario_id")
    private int usuarioId;
    @Basic(optional = false)
    @Column(name = "servicio_id")
    private short servicioId;

    public VisitaPK() {
    }

    public VisitaPK(int usuarioId, short servicioId) {
        this.usuarioId = usuarioId;
        this.servicioId = servicioId;
    }

    public int getUsuarioId() {
        return usuarioId;
    }

    public void setUsuarioId(int usuarioId) {
        this.usuarioId = usuarioId;
    }

    public short getServicioId() {
        return servicioId;
    }

    public void setServicioId(short servicioId) {
        this.servicioId = servicioId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) usuarioId;
        hash += (int) servicioId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VisitaPK)) {
            return false;
        }
        VisitaPK other = (VisitaPK) object;
        if (this.usuarioId != other.usuarioId) {
            return false;
        }
        if (this.servicioId != other.servicioId) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.VisitaPK[usuarioId=" + usuarioId + ", servicioId=" + servicioId + "]";
    }

}
